package com.mdd.apiinterface.controller;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mdd.mddapiclientsdk.model.User;
import com.mdd.mddapiclientsdk.utils.SignUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Mdd
 * @Github <a href="https://github.com/mdd123cc"/>
 * @Gitee <a href="https://gitee.com/mdd115192"/>
 *
 */
@RestController
@RequestMapping("/name")
public class NameController {

    @GetMapping("/get")
    public String getUserNameByGet(String name){
        return "GET:"+name;
    }
    @PostMapping("/post")
    public String getUserNameByPost(@RequestParam String name){
        return "POST:"+name;
    }

    @PostMapping("/json")
    public String getUserNameByPost(@RequestBody User user, HttpServletRequest request){
        if (user == null) {
            throw new RuntimeException("请求参数为空");
        }
        return "POST:Body:"+user.getUsername();
    }
}
